#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
#endregion

namespace Ramparts
{
    /// <summary>
    /// Ramparts--an open source remake of the classic arcade game
    /// done by Julian F. Jason F. and Doug G. 
    /// </summary>
    public class Ramparts : Microsoft.Xna.Framework.Game
    {
       
        public GraphicsDeviceManager graphics;
        public ContentManager content;
        public SceneManager sceneManager;
        public SpriteBatch spriteBatch;
        public string[] args;

        // Camera 2D
        

        public Ramparts(string[] args)
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);
            this.args = args;
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
          
            sceneManager = new SceneManager(this);
            
            Console.WriteLine("Starting with scene: " + Convert.ToInt32(args[0]));
            
            sceneManager.initSceneManager(Convert.ToInt32(args[0]));
            
            sceneManager.loadSceneFromFile();
            
            spriteBatch = new SpriteBatch(graphics.GraphicsDevice);
            
            sceneManager.loadSceneFromFile();
            
            IsMouseVisible = false;

        }


        /// <summary>
        /// Load your graphics content.  If loadAllContent is true, you should
        /// load content from both ResourceManagementMode pools.  Otherwise, just
        /// load ResourceManagementMode.Manual content.
        /// </summary>
        /// <param name="loadAllContent">Which type of content to load.</param>
        protected override void LoadContent()
        {
               // This Should Preload All Graphics From All Scenes
        }


        /// <summary>
        /// Unload your graphics content.  If unloadAllContent is true, you should
        /// unload content from both ResourceManagementMode pools.  Otherwise, just
        /// unload ResourceManagementMode.Manual content.  Manual content will get
        /// Disposed by the GraphicsDevice during a Reset.
        /// </summary>
        /// <param name="unloadAllContent">Which type of content to unload.</param>
        protected override void UnloadContent()
        {
            // TODO: Unload any ResourceManagementMode.Manual content
        }


        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Send Updates To The SceneManager For Updates
            sceneManager.Update(gameTime);
        }


        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            
            // Scene Manager Draws the Scene
            graphics.GraphicsDevice.Clear(Color.BlanchedAlmond);
            sceneManager.DrawScene();
            
        }
    }
}
